import React from 'react';
import './App.css';

class App extends React.Component{
  constructor(props) {
    super(props)
  };

  add=()=>{
    // 通过dispatch来分发动作，如果要传参则在对象里面传参
    this.props.store.dispatch({type:'add'})

  }

  de=()=>{
    this.props.store.dispatch({type:'de'})
  }


  render() {
    let count = this.props.store.getState();
    console.log(count);
    
    return (
      <div className="App">
        hello
        <h2>
         <button onClick={this.de}>-</button> {count.count} <button onClick={this.add}>+</button>
        </h2>
      </div>
    );
  }
}

export default App;

// var a =function (){
//    this.b=3;
// }
// var c =new a();
// var b = 7;
// a();

// console.log(b);
// console.log(c.b);

